import java.util.Scanner;
public class main5 {
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        while(input.hasNextInt()){
            int a=input.nextInt();
            int tot=0;
            for(int i=1;i<=a;i++){
                int tot2=1;
                for(int j=1;j<=i;j++){
                    tot2*=j;
                }
                tot+=tot2;
            }
            System.out.println("从1到"+a+"的阶乘和是"+tot+"\n");
        }
    }
}
